import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import asidemenue from '@/components/aside/'
import asideneitui from '@/components/aside/neituiaside'
import personaside from '@/views/person/personaside.vue'


// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push (location, onResolve, onReject) {
//   if (onResolve || onReject){
//     return originalPush.call(this, location, onResolve, onReject)
//   }
//   return originalPush.call(this, location).catch(err => err)
// }
Vue.use(VueRouter)
export const asyncRoutes = [

]

export const constantRoutes = [
  {
    path: '/hello',
    name: 'Hello',
    component: () => import('@/views/Hello.vue')
  },

  {
    path: '/regist',
    name: 'Regist',
    component: () => import('@/views/Regist.vue')
  },
  {
    path: '/',
    name: 'Home',
    components: {
      default: Home,
      asidemenu: asidemenue
    }
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
      asidemenu: personaside
    }
  },
  {
    path: '/markdown',
    name: 'Markdown',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.

    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/MarkDown.vue'),
      asidemenu: asidemenue
    }
  },
  {
    path: '/neitui',
    name: 'Neitui',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/Neitui.vue'),
      asidemenu: asideneitui
    }
  },
  {
    path: '/blobtaglist/:tagid(\\d+)',
    name: 'BlobList',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/BlobList.vue')
  },
  {
    path: '/reource',
    name: 'Resource',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/reource.vue'),
      asidemenu: asideneitui
    }
  },

  {
    path: '/resourcedetail/:id(\\d+)',
    name: 'resourcedetail',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/resourcedetail.vue')
  },
  {
    path: '/person/index',
    name: 'PersonIndex',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/person/index.vue'),
      asidemenu: personaside
    }
  },

]

const router = new VueRouter({
  // mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

export default router
